//
//  BTCycleImageViewController.m
//  BaseTools
//
//  Created by 李挺哲 on 15/8/27.
//  Copyright (c) 2015年 ltz. All rights reserved.
//

#import "BTCycleImageViewController.h"
#import "BTCycleScrollView.h"
@interface BTCycleImageViewController ()<BTCycleScrollViewDelegate>

@end

@implementation BTCycleImageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initNavigationTitle:@"图片轮播" barTintColor:0x1E86CB titleColor:0xFFFFFF isTranslucent:NO isHidden:NO];
    [self showNavigationLeftButtonTitle:@"返回" tintColor:0xFFFFFF];

    // 情景一：采用本地图片实现
    NSArray *imagesURL = @[@"http://pica.nipic.com/2007-11-09/200711912453162_2.jpg",@"http://img.taopic.com/uploads/allimg/130501/240451-13050106450911.jpg"];
    
    
    
    // 情景三：图片配文字
    NSArray *titles = @[@"广告1",
                        @"广告2",
                        ];
    
    
    
    CGFloat w = self.view.bounds.size.width;
    
    // 本地加载 --- 创建不带标题的图片轮播器
    BTCycleScrollView *cycleScrollView = [BTCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 100, w, 180) imagesUrl:imagesURL];
    cycleScrollView.titlesGroup=titles;
    cycleScrollView.infiniteLoop = YES;
    cycleScrollView.delegate = self;
//    cycleScrollView.autoScroll=NO;
    cycleScrollView.pageControlStyle = BTCycleScrollViewPageContolStyleAnimated;
    [self.view addSubview:cycleScrollView];
    //         --- 轮播时间间隔，默认1.0秒，可自定义
    cycleScrollView.autoScrollTimeInterval = 5.0f;
    
    
    
    
}



- (void)cycleScrollView:(BTCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    NSLog(@"---点击了第%ld张图片", (long)index);
}



@end
